@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Poppins&display=swap');

* {
  box-sizing: border-box;
}

body {
  background-color: #fafafa;
  font-family: 'Roboto', sans-serif;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: 100vh;
  overflow: hidden;
}

.magic {
  color: #fff;
  font-size: 16px;
  font-family: 'Poppins', sans-serif;
  /* 相对于浏览器窗口进行定位 */
  position: fixed;
  top: 40px;
  /* 字符之间的间距 */
  letter-spacing: 1px;
  /* 去除默认样式 */
  border: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
  background-color: #f9ca24;
  padding: 12px;
  border-radius: 5px;
  box-shadow: 0 3px 0 rgba(249, 202, 36, 0.5);
}

/* 给按钮增加点击下沉的效果 */
.magic:active {
  /* 沿Y轴下滑3px */
  transform: translateY(3px);
  box-shadow: none;
}

.boxes {
  display: flex;
  /* 子元素的超过一行换行且均匀分布 */
  flex-wrap: wrap;
  justify-content: space-around;
  width: 500px;
  height: 500px;
  /* 是为了最小化影响吗 */
  position: relative;
  /* ease 规定慢速开始，然后变快，然后慢速结束的过渡效果 */
  transition: 0.4s ease;
}

.boxes.big {
  width: 600px;
  height: 600px;
}

.boxes.big .box {
  transform: rotateZ(360deg);
}

/* 动态追加的小盒子 */
.box {
  width: 125px;
  height: 125px;
  position: relative;
  transition: 0.4s ease;
  /* 设置背景 */
  background-image: url('https://media.giphy.com/media/EZqwsBSPlvSda/giphy.gif');
  background-repeat: no-repeat;
  /* 设置图片的宽度和高度 */
  background-size: 500px 500px;
}

.box::after {
  content: '';
  height: 100%;
  width: 15px;
  background-color: #f6e58d;
  position: absolute;
  top: 8px;
  right: -15px;
  /* 定义沿着 Y 轴的 2D 倾斜转换。 */
  transform: skewY(45deg);
}
.box::before {
  content: '';
  height: 15px;
  width: 100%;
  background-color: #f9ca24;
  position: absolute;
  bottom: -15px;
  left: 8px;
  transform: skewX(45deg);
}